g_warning() if setting the local fails, like gdk_set_locale() did.
authorOwen Taylor <otaylor@redhat.com>
Wed, 13 Feb 2002 17:48:01 +0000 (17:48 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 13 Feb 2002 17:48:01 +0000 (17:48 +0000)
Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
        the local fails, like gdk_set_locale() did.

        * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
        Don't free local_list if local_count == 0. (#71241, reported
        by Kevin Vandersloot.)

        * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
        Clean up list == NULL handling and failure.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/x11/gdkselection-x11.c
gtk/gtkmain.c

index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index e357064c65a4916360997d6cc09bece7c83ef006..159fdcdf240611d1fcc12d79eed18cb7667bf46c 100644 (file)
@@ -1,3 +1,15 @@
+Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
+       the local fails, like gdk_set_locale() did.
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): 
+       Don't free local_list if local_count == 0. (#71241, reported
+       by Kevin Vandersloot.)
+
+       * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): 
+       Clean up list == NULL handling and failure.
+
 Wed Feb 13 11:27:31 2002  Owen Taylor  <otaylor@redhat.com>
 
        * tests/testtreeview.c (typesystem_recurse): Cast GType
index 893d475ce1ed999955f7fd848f91c08c43cac60b..def7c65930417317dd3dc1ab56bf89083ff481b2 100644 (file)
@@ -305,21 +305,30 @@ gdk_text_property_to_text_list (GdkAtom       encoding,
   XTextProperty property;
   gint count = 0;
   gint res;
-
-  if (!list) 
-    return 0;
+  gchar **local_list;
 
   property.value = (guchar *)text;
   property.encoding = gdk_x11_atom_to_xatom (encoding);
   property.format = format;
   property.nitems = length;
-  res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
+  res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, &local_list, &count);
 
-  if (res == XNoMemory || res == XLocaleNotSupported || 
-      res == XConverterNotFound)
-    return 0;
+  if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound)
+    {
+      if (list)
+       *list = NULL;
+
+      return 0;
+    }
   else
-    return count;
+    {
+      if (list)
+       *list = local_list;
+      else
+       XFreeStringList (local_list);
+      
+      return count;
+    }
 }
 
 void
@@ -482,8 +491,10 @@ gdk_text_property_to_utf8_list (GdkAtom        encoding,
                (*list)[count++] = g_strdup (local_list[i]);
            }
        }
+
+      if (local_count)
+       gdk_free_text_list (local_list);
       
-      gdk_free_text_list (local_list);
       (*list)[count] = NULL;
 
       return count;
index 37eb587fc9786a27cddc17d7db49df8b0b894a80..a6d5c1975adc4efd2c9558ced41e95ea8e509079 100644 (file)
@@ -458,7 +458,10 @@ gtk_init_check (int         *argc,
 #endif
 
   if (do_setlocale)
-    setlocale (LC_ALL, "");
+    {
+      if (!setlocale (LC_ALL, ""))
+       g_warning ("Locale not supported by C library.\n\tUsing the fallback 'C' locale.");
+    }
   
   /* Initialize "gdk". We pass along the 'argc' and 'argv'
    *  parameters as they contain information that GDK uses